package com.building18.service.impl;

import com.building18.annotations.RequirePermCheck;
import com.building18.mapper.BuildingMapper;
import com.building18.pojo.Building;
import com.building18.pojo.Result;
import com.building18.service.BuildingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BuildingServiceImpl implements BuildingService {
    @Autowired
    private BuildingMapper buildingMapper;

    @Override
    public List<Building> selectBuilding() {
        return buildingMapper.selectBuilding();
    }

    @Override
    @RequirePermCheck("building:add")
    public Integer addBuilding(Building building) {
        return buildingMapper.addBuilding(building);
    }

    @Override
    @RequirePermCheck("building:del")
    public Integer deleteBuildingById(Integer id) {
        return buildingMapper.deleteBuildingById(id);
    }

    @Override
    public List<Building> selectBuildingByName(String name) {
        return buildingMapper.selectBuildingByName(name);
    }

    @Override
    @RequirePermCheck("building:update")
    public Integer updateBuilding(Building building) {
        return buildingMapper.updateBuilding(building);
    }

    @Override
    public Integer countHouseByBuildingId(Integer id) {
        return buildingMapper.countHouseByBuildingId(id);
    }

    @Override
    @RequirePermCheck("building:del")
    public Integer deleteBuildingByIds(List<Integer> ids) {
        return buildingMapper.deleteBuildingByIds(ids);
    }

    @Override
    public List<Building> selectBuildingIdAndName() {
        return buildingMapper.selectBuildingIdAndName();
    }
}
